package com.abing.starry.util;

import cn.hutool.core.lang.UUID;
import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester;

import static com.abing.starry.constant.SaltConstant.SALT;

/**
 * @Author CaptainBing
 * @Date 2024/8/15 11:10
 * @Description
 */
public class EncryptUtils {

    /**
     * 生成密码
     * @param userPassword
     * @return
     */
    public static String genUserPassword(String userPassword){
        Digester md5 = new Digester(DigestAlgorithm.MD5);
        return md5.digestHex(userPassword + SALT);
    }


    /**
     * 生成 Api 密钥对
     * @return
     */
    public static String genApiKey(){

        return UUID.fastUUID().toString(true);
    }


}
